package org.jeecg.modules.demo.mes.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.jeecg.modules.demo.mes.entity.ManageDevice;
import org.jeecg.modules.demo.mes.mapper.ManageDeviceMapper;
import org.jeecg.modules.demo.mes.service.IManageDeviceService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description: 亚临界设备表
 * @Author: jeecg-boot
 * @Date:   2023-01-12
 * @Version: V1.0
 */
@Service
public class ManageDeviceServiceImpl extends ServiceImpl<ManageDeviceMapper, ManageDevice> implements IManageDeviceService {


    @Resource
    private ManageDeviceMapper manageDeviceMapper;
    @Override
    public List<ManageDevice> selList() {
        return manageDeviceMapper.selList();
    }


    @Override
    public ManageDevice getByDeviceCode(String deviceCode) {
        QueryWrapper<ManageDevice> manageDeviceQueryWrapper = new QueryWrapper<>();
        manageDeviceQueryWrapper.eq("device_code",deviceCode);
        List<ManageDevice> list = list(manageDeviceQueryWrapper);
        if (list.isEmpty()) {
            return null;
        }
        return list.get(0);
    }

}
